package dataStructure.xmg1.a14;

import dataStructure.xmg1.a14.heap.BinaryHeap;
import dataStructure.xmg1.a14.printer.BinaryTrees;

import java.util.Comparator;

/**
 * @author: vince_zww
 * @date: 2021/10/6 22:35
 * @desceription:
 */
public class Main {

    public static void main(String[] args) {
//        test1();
//        test2();
        Integer[] data = {88,44,53,41,16,6,17,70,18,85,98,81,23,36,43,37};

        BinaryHeap<Integer> heap = new BinaryHeap<>(data, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        });
        BinaryTrees.println(heap);


    }

    private static void test2() {
        Integer[] data = {88,44,53,41,16,6,17,70,18,85,98,81,23,36,43,37};

        BinaryHeap<Integer> heap = new BinaryHeap<>(data);
//        for (int i = 0; i < data.length; i++) {
//            heap.add(data[i]);
//        }
        BinaryTrees.println(heap);

        data[0] = 1000;
        BinaryTrees.println(heap);
    }


    private static void test1() {
        BinaryHeap<Integer> heap = new BinaryHeap<>();
        heap.add(68);
        heap.add(72);
        heap.add(43);
        heap.add(50);
        heap.add(38);
        heap.add(10);
        heap.add(65);
        heap.add(70);
        heap.add(99);

        BinaryTrees.println(heap);
//        heap.remove();
//        BinaryTrees.println(heap);

        System.out.println(heap.replace(73));
        BinaryTrees.println(heap);
    }
}
